package com.netease.pris.a;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.text.TextUtils;
import com.netease.l.a.a;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Vector;

public class i
{
  static byte[] a;
  public static String b;
  static final String c = "!#$%&'()*+,-./:;=?@[\\]^_`{|}~";
  private static final String d = "EEE MMM dd HH:mm:ss Z yyyy";
  private static final String e = "yyyy-MM-dd HH:mm";
  private static SimpleDateFormat f;
  private static SimpleDateFormat g;
  private static final int h = 7;
  private static final char[] i;

  static
  {
    byte[] arrayOfByte = new byte[16];
    arrayOfByte[0] = -10;
    arrayOfByte[1] = 86;
    arrayOfByte[2] = -63;
    arrayOfByte[3] = -59;
    arrayOfByte[4] = 108;
    arrayOfByte[5] = -67;
    arrayOfByte[6] = 70;
    arrayOfByte[7] = -64;
    arrayOfByte[8] = -67;
    arrayOfByte[9] = 55;
    arrayOfByte[10] = -101;
    arrayOfByte[11] = -27;
    arrayOfByte[12] = 54;
    arrayOfByte[13] = -56;
    arrayOfByte[14] = -37;
    arrayOfByte[15] = 0;
    a = arrayOfByte;
    f = null;
    g = null;
    b = null;
    char[] arrayOfChar = new char[16];
    arrayOfChar[0] = 48;
    arrayOfChar[1] = 49;
    arrayOfChar[2] = 50;
    arrayOfChar[3] = 51;
    arrayOfChar[4] = 52;
    arrayOfChar[5] = 53;
    arrayOfChar[6] = 54;
    arrayOfChar[7] = 55;
    arrayOfChar[8] = 56;
    arrayOfChar[9] = 57;
    arrayOfChar[10] = 97;
    arrayOfChar[11] = 98;
    arrayOfChar[12] = 99;
    arrayOfChar[13] = 100;
    arrayOfChar[14] = 101;
    arrayOfChar[15] = 102;
    i = arrayOfChar;
  }

  public static String a(long paramLong)
  {
    return b().format(Long.valueOf(paramLong));
  }

  public static String a(Context paramContext)
  {
    if ((b == null) || (b.length() == 0))
      b = b(paramContext);
    return b;
  }

  public static String a(String paramString)
  {
    if ((TextUtils.isEmpty(paramString)) || (paramString.equalsIgnoreCase("null")))
      paramString = null;
    return paramString;
  }

  public static String a(String paramString, char paramChar)
  {
    int j = 0;
    if ((paramString == null) || (paramString.length() == 0))
      paramString = null;
    while (true)
    {
      return paramString;
      int k = paramString.indexOf(paramChar, 0);
      if (k == -1)
        continue;
      int m = paramString.length();
      StringBuilder localStringBuilder = new StringBuilder(paramString.length());
      do
      {
        localStringBuilder.append(paramString.substring(j, k));
        j = k + 1;
        k = paramString.indexOf(paramChar, j);
      }
      while (k != -1);
      if (j < m)
        localStringBuilder.append(paramString.substring(j, m));
      paramString = localStringBuilder.toString();
    }
  }

  public static String a(String paramString, int paramInt)
  {
    int j;
    if (a(paramString, paramInt, "http://"))
      j = "http://".length();
    int m;
    while (true)
    {
      int k = paramString.length();
      while (true)
      {
        if (paramInt + j >= k)
          break label164;
        m = paramString.charAt(paramInt + j);
        if (((m < 65) || (m > 90)) && ((m < 97) || (m > 122)) && ((m < 48) || (m > 57)))
          break;
        j++;
      }
      if (a(paramString, paramInt, "www."))
      {
        j = "www.".length();
        continue;
      }
      if (a(paramString, paramInt, "wap."))
      {
        j = "wap.".length();
        continue;
      }
      if (!a(paramString, paramInt, "https://"))
        break;
      j = "https://".length();
    }
    label164: for (String str = null; ; str = paramString.substring(paramInt, j + paramInt))
    {
      return str;
      if ("!#$%&'()*+,-./:;=?@[\\]^_`{|}~".indexOf(m) < 0)
        continue;
      j++;
      break;
    }
  }

  public static String a(String paramString1, String paramString2, String paramString3)
  {
    return paramString1.replace(paramString2, paramString3);
  }

  public static String a(String paramString1, String[] paramArrayOfString, String paramString2)
  {
    Object localObject;
    if ((paramString1 == null) || (paramString1.length() == 0) || (paramArrayOfString == null) || (paramArrayOfString.length == 0))
      localObject = "";
    while (true)
    {
      return localObject;
      int j = paramArrayOfString.length;
      int k = 0;
      String str;
      for (localObject = paramString1; k < j; localObject = str)
      {
        str = ((String)localObject).replace(paramArrayOfString[k], paramString2);
        k++;
      }
      if (localObject != null)
        continue;
      localObject = "";
    }
  }

  private static DateFormat a()
  {
    if (f == null)
      f = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.US);
    return f;
  }

  public static Hashtable a(Hashtable paramHashtable)
  {
    if (paramHashtable != null);
    for (Hashtable localHashtable = (Hashtable)paramHashtable.clone(); ; localHashtable = null)
      return localHashtable;
  }

  public static Vector a(String paramString1, String paramString2)
  {
    Object localObject = null;
    if ((paramString1 == null) || (paramString1.length() <= 0) || (paramString2 == null) || (paramString2.length() <= 0));
    while (true)
    {
      return localObject;
      String[] arrayOfString = paramString1.split(paramString2);
      if (arrayOfString.length <= 0)
        continue;
      Vector localVector = new Vector();
      for (int j = 0; j < arrayOfString.length; j++)
        localVector.addElement(arrayOfString[j]);
      localObject = localVector;
    }
  }

  public static void a(LinkedList paramLinkedList1, LinkedList paramLinkedList2)
  {
    if ((paramLinkedList1 == null) || (paramLinkedList2 == null) || (paramLinkedList1.size() == 0) || (paramLinkedList2.size() == 0))
      return;
    int j = -1 + paramLinkedList2.size();
    label31: if (j >= 0)
      if (!((com.netease.pris.atom.u)paramLinkedList1.get(0)).equals(paramLinkedList2.get(j)));
    for (int k = paramLinkedList2.size() - j; ; k = -1)
    {
      if (k > paramLinkedList1.size())
      {
        paramLinkedList1.clear();
        break;
        j--;
        break label31;
      }
      if (k < 0)
        break;
      paramLinkedList1.subList(0, k).clear();
      break;
    }
  }

  public static void a(Vector paramVector)
  {
    int j = 0;
    if ((paramVector != null) && (paramVector.size() > 0))
    {
      Object[] arrayOfObject1 = new Object[paramVector.size()];
      Object[] arrayOfObject2 = new Object[paramVector.size()];
      paramVector.copyInto(arrayOfObject1);
      paramVector.copyInto(arrayOfObject2);
      a(arrayOfObject1, arrayOfObject2, 0, arrayOfObject1.length, 0);
      while (j < arrayOfObject2.length)
      {
        paramVector.setElementAt(arrayOfObject2[j], j);
        j++;
      }
    }
  }

  private static void a(Object[] paramArrayOfObject, int paramInt1, int paramInt2)
  {
    Object localObject = paramArrayOfObject[paramInt1];
    paramArrayOfObject[paramInt1] = paramArrayOfObject[paramInt2];
    paramArrayOfObject[paramInt2] = localObject;
  }

  private static void a(Object[] paramArrayOfObject1, Object[] paramArrayOfObject2, int paramInt1, int paramInt2, int paramInt3)
  {
    int j = paramInt2 - paramInt1;
    if (j < 7)
      for (int i6 = paramInt1; i6 < paramInt2; i6++)
        for (int i7 = i6; (i7 > paramInt1) && (((Comparable)paramArrayOfObject2[(i7 - 1)]).compareTo(paramArrayOfObject2[i7]) > 0); i7--)
          a(paramArrayOfObject2, i7, i7 - 1);
    int k = paramInt1 + paramInt3;
    int m = paramInt2 + paramInt3;
    int n = k + m >> 1;
    a(paramArrayOfObject2, paramArrayOfObject1, k, n, -paramInt3);
    a(paramArrayOfObject2, paramArrayOfObject1, n, m, -paramInt3);
    if (((Comparable)paramArrayOfObject1[(n - 1)]).compareTo(paramArrayOfObject1[n]) <= 0)
    {
      System.arraycopy(paramArrayOfObject1, k, paramArrayOfObject2, paramInt1, j);
      return;
    }
    int i1 = n;
    label155: int i4;
    int i5;
    if (paramInt1 < paramInt2)
    {
      if ((i1 < m) && ((k >= n) || (((Comparable)paramArrayOfObject1[k]).compareTo(paramArrayOfObject1[i1]) > 0)))
        break label232;
      int i2 = k + 1;
      paramArrayOfObject2[paramInt1] = paramArrayOfObject1[k];
      int i3 = i1;
      i4 = i2;
      i5 = i3;
    }
    while (true)
    {
      paramInt1++;
      k = i4;
      i1 = i5;
      break label155;
      break;
      label232: i5 = i1 + 1;
      paramArrayOfObject2[paramInt1] = paramArrayOfObject1[i1];
      i4 = k;
    }
  }

  public static boolean a(int paramInt1, int paramInt2, int paramInt3)
  {
    int j = 0;
    if ((paramInt1 <= 0) || (paramInt2 <= 0) || (paramInt3 <= 0));
    while (true)
    {
      return j;
      if ((paramInt1 < paramInt2) || ((paramInt1 - paramInt2) % paramInt3 != 0))
        continue;
      j = 1;
    }
  }

  // ERROR //
  public static boolean a(File paramFile1, File paramFile2)
  {
    // Byte code:
    //   0: new 246	java/io/FileInputStream
    //   3: dup
    //   4: aload_0
    //   5: invokespecial 249	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   8: astore_2
    //   9: aload_2
    //   10: aload_1
    //   11: invokestatic 252	com/netease/pris/a/i:a	(Ljava/io/InputStream;Ljava/io/File;)Z
    //   14: istore 6
    //   16: iload 6
    //   18: istore 5
    //   20: aload_2
    //   21: invokevirtual 257	java/io/InputStream:close	()V
    //   24: goto +15 -> 39
    //   27: astore_3
    //   28: aload_2
    //   29: invokevirtual 257	java/io/InputStream:close	()V
    //   32: aload_3
    //   33: athrow
    //   34: astore 4
    //   36: iconst_0
    //   37: istore 5
    //   39: iload 5
    //   41: ireturn
    //
    // Exception table:
    //   from	to	target	type
    //   9	16	27	finally
    //   0	9	34	java/io/IOException
    //   20	34	34	java/io/IOException
  }

  public static boolean a(File paramFile, String paramString)
  {
    int j = 0;
    if (!paramFile.exists());
    while (true)
    {
      return j;
      MessageDigest localMessageDigest;
      FileInputStream localFileInputStream;
      try
      {
        localMessageDigest = MessageDigest.getInstance("MD5");
        byte[] arrayOfByte = new byte[4096];
        localFileInputStream = new FileInputStream(paramFile);
        while (true)
        {
          int k = localFileInputStream.read(arrayOfByte);
          if (k <= 0)
            break;
          localMessageDigest.update(arrayOfByte, 0, k);
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
      }
      continue;
      localFileInputStream.close();
      for (String str = new BigInteger(1, localMessageDigest.digest()).toString(16); str.length() < 32; str = "0" + str);
      boolean bool = paramString.equals(str);
      j = bool;
    }
  }

  public static boolean a(InputStream paramInputStream, File paramFile)
  {
    int j = 0;
    try
    {
      FileOutputStream localFileOutputStream = new FileOutputStream(paramFile);
      try
      {
        byte[] arrayOfByte = new byte[4096];
        int k = paramInputStream.read(arrayOfByte);
        if (k >= 0)
          localFileOutputStream.write(arrayOfByte, 0, k);
      }
      finally
      {
        localFileOutputStream.close();
      }
      j = 1;
    }
    catch (IOException localIOException)
    {
    }
    return j;
  }

  public static boolean a(String paramString1, int paramInt, String paramString2)
  {
    int j = paramString2.length();
    int m;
    if (paramInt + j > paramString1.length())
      m = 0;
    while (true)
    {
      return m;
      for (int k = 0; ; k++)
      {
        if (k < j)
        {
          int n = paramString1.charAt(paramInt + k);
          if ((n >= 65) && (n <= 90))
            n += 32;
          if (n == paramString2.charAt(k))
            continue;
        }
        if ((k != j) || (k <= 0))
          break label95;
        m = 1;
        break;
      }
      label95: m = 0;
    }
  }

  public static char[] a(byte[] paramArrayOfByte)
  {
    int j = 0;
    int k = paramArrayOfByte.length;
    char[] arrayOfChar = new char[k << 1];
    for (int m = 0; m < k; m++)
    {
      int n = j + 1;
      arrayOfChar[j] = i[((0xF0 & paramArrayOfByte[m]) >>> 4)];
      j = n + 1;
      arrayOfChar[n] = i[(0xF & paramArrayOfByte[m])];
    }
    return arrayOfChar;
  }

  public static String b(long paramLong)
  {
    String str;
    if (paramLong < 1024L)
      str = paramLong + "B";
    while (true)
    {
      return str;
      if ((paramLong >= 1024L) && (paramLong < 1048576L))
      {
        int m = (int)(paramLong / 1024L);
        int n = (int)(paramLong * 10L / 1024L % 10L);
        if (n > 0)
        {
          str = m + "." + n + "K";
          continue;
        }
        str = m + "K";
        continue;
      }
      int j = (int)(paramLong / 1048576L);
      int k = (int)(paramLong * 10L / 1048576L % 10L);
      if (k > 0)
      {
        str = j + "." + k + "M";
        continue;
      }
      str = j + "M";
    }
  }

  public static String b(Context paramContext)
  {
    String str = "";
    try
    {
      str = paramContext.getPackageManager().getPackageInfo(paramContext.getPackageName(), 0).versionName;
      return str;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      while (true)
        localNameNotFoundException.printStackTrace();
    }
  }

  public static String b(String paramString)
  {
    Date localDate1 = new Date();
    if (a(paramString) == null)
      paramString = b().format(localDate1);
    while (true)
    {
      return paramString;
      try
      {
        Date localDate3 = a().parse(paramString);
        localDate2 = localDate3;
        if (localDate2 == null)
          continue;
        paramString = b().format(localDate2);
      }
      catch (ParseException localParseException)
      {
        while (true)
        {
          localParseException.printStackTrace();
          Date localDate2 = localDate1;
        }
      }
    }
  }

  public static String b(String paramString1, String paramString2)
  {
    int j = 0;
    if ((paramString1 == null) || (paramString1.length() == 0))
      paramString1 = null;
    while (true)
    {
      return paramString1;
      int k = paramString1.indexOf(paramString2, 0);
      if (k == -1)
        continue;
      int m = paramString1.length();
      int n = paramString2.length();
      StringBuilder localStringBuilder = new StringBuilder(paramString1.length());
      do
      {
        localStringBuilder.append(paramString1.substring(j, k));
        j = k + n;
        k = paramString1.indexOf(paramString2, j);
      }
      while (k != -1);
      if (j < m)
        localStringBuilder.append(paramString1.substring(j, m));
      paramString1 = localStringBuilder.toString();
    }
  }

  private static DateFormat b()
  {
    if (g == null)
      g = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
    return g;
  }

  public static long c(String paramString)
  {
    long l = 0L;
    if (a(paramString) == null);
    while (true)
    {
      return l;
      try
      {
        Date localDate2 = a().parse(paramString);
        localDate1 = localDate2;
        if (localDate1 == null)
          continue;
        l = localDate1.getTime();
      }
      catch (ParseException localParseException)
      {
        while (true)
        {
          localParseException.printStackTrace();
          Date localDate1 = null;
        }
      }
    }
  }

  public static String c(Context paramContext)
  {
    byte[] arrayOfByte = e(paramContext);
    if ((arrayOfByte == null) || (arrayOfByte.length != 4));
    for (String str = null; ; str = Integer.toString(0xFF & arrayOfByte[0] | (0xFF & arrayOfByte[1]) << 8 | (0xFF & arrayOfByte[2]) << 16 | (0xFF & arrayOfByte[3]) << 24))
      return str;
  }

  public static String d(Context paramContext)
  {
    int j = 0;
    byte[] arrayOfByte1 = e(paramContext);
    if ((arrayOfByte1 == null) || (arrayOfByte1.length != 4));
    String str2;
    for (String str1 = null; ; str1 = null)
    {
      return str1;
      byte[] arrayOfByte2 = new byte[4];
      for (int k = 0; k < arrayOfByte1.length; k++)
        arrayOfByte2[k] = arrayOfByte1[(-1 + (arrayOfByte1.length - k))];
      str2 = new String(a(arrayOfByte2));
      if (str2.length() % 2 == 0)
        break;
    }
    String str3 = u.g(paramContext);
    if ((str3 != null) && (str3.length() >= 1));
    for (int m = str3.charAt(-1 + str3.length()); ; m = 48)
    {
      int n = str2.length() / 2;
      StringBuilder localStringBuilder = new StringBuilder();
      while (j < n)
      {
        String str4 = Integer.toHexString(m ^ Integer.decode("0x" + str2.substring(j * 2, 2 * (j + 1))).intValue());
        if (str4.length() <= 1)
          localStringBuilder.append('0');
        localStringBuilder.append(str4);
        j++;
      }
      str1 = localStringBuilder.toString();
      break;
    }
  }

  public static String d(String paramString)
  {
    if (paramString == null)
      paramString = "";
    return paramString;
  }

  public static boolean e(String paramString)
  {
    if ((paramString == null) || (paramString.length() == 0));
    for (int j = 1; ; j = 0)
      return j;
  }

  public static byte[] e(Context paramContext)
  {
    int j = 0;
    Object localObject = null;
    byte[] arrayOfByte1;
    InputStream localInputStream;
    try
    {
      arrayOfByte1 = new byte[21];
      int k = a.b(1);
      if (k == -1)
        break label179;
      localInputStream = paramContext.getResources().openRawResource(k);
      if ((localInputStream == null) || (localInputStream.available() < 21))
      {
        if (localInputStream == null)
          break label179;
        localInputStream.close();
      }
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
    }
    if (localInputStream.read(arrayOfByte1, 0, 21) != 21)
    {
      localInputStream.close();
    }
    else
    {
      byte[] arrayOfByte2 = new byte[16];
      System.arraycopy(arrayOfByte1, 0, arrayOfByte2, 0, 16);
      if ((arrayOfByte2 != null) && (arrayOfByte2.length == 16))
        while (true)
          if (j < a.length)
          {
            if (a[j] != arrayOfByte2[j])
              break;
            j++;
            continue;
          }
          else
          {
            if (arrayOfByte1[16] != 0)
              break;
            byte[] arrayOfByte3 = new byte[4];
            System.arraycopy(arrayOfByte1, 17, arrayOfByte3, 0, 4);
            localObject = arrayOfByte3;
          }
    }
    label179: return localObject;
  }

  public static boolean f(String paramString)
  {
    int j = 1;
    String str = paramString + "_tmp";
    try
    {
      Runtime localRuntime1 = Runtime.getRuntime();
      String[] arrayOfString1 = new String[3];
      arrayOfString1[0] = "mv";
      arrayOfString1[1] = paramString;
      arrayOfString1[2] = str;
      localRuntime1.exec(arrayOfString1).waitFor();
      Runtime localRuntime2 = Runtime.getRuntime();
      String[] arrayOfString2 = new String[2];
      arrayOfString2[0] = "mkdir";
      arrayOfString2[1] = paramString;
      localRuntime2.exec(arrayOfString2).waitFor();
      Runtime localRuntime3 = Runtime.getRuntime();
      String[] arrayOfString3 = new String[3];
      arrayOfString3[0] = "rm";
      arrayOfString3[1] = "-r";
      arrayOfString3[2] = str;
      localRuntime3.exec(arrayOfString3);
      return j;
    }
    catch (Exception localException)
    {
      while (true)
      {
        localException.printStackTrace();
        j = 0;
      }
    }
  }

  public static String g(String paramString)
  {
    String[] arrayOfString = new String[3];
    arrayOfString[0] = "　";
    arrayOfString[1] = "\r";
    arrayOfString[2] = "\n";
    return a(paramString, arrayOfString, "");
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.a.i
 * JD-Core Version:    0.6.0
 */